import request from '@/util/axios';
import type { RegistrationList, assetSelectTable } from './assessment_report_type';

// 统一管理接口
enum API {
  LIST = '/platform-entry/api/data_evaluation/list', // 列表
  DETAIL = '/platform-entry/api/compliance_registration/asset_compliance/detail', // 查看报告
  ASSET_SELECT = '/platform-entry/api/asset/package/list', //资产选择数据
  ASSET_REGISTER = '/platform-entry/api/compliance_registration/asset_compliance/create', //创建合规登记
}

// 评价报告列表
export async function evaluationList(params: RegistrationList) {
  try {
    return await request.post(API.LIST, params);
  } catch (error) {
    console.error('获取评价报告列表时发生错误：', error);
    return error;
  }
}

// 查看报告
export async function comRegDetail(params: { id: number }) {
  try {
    return await request.get(API.DETAIL, { params });
  } catch (error) {
    console.error('查看报告时发生错误：', error);
    return error;
  }
}

//资产选择列表数据
export async function assetSelectList(params: assetSelectTable) {
  try {
    return await request.get(API.ASSET_SELECT, { params });
  } catch (error) {
    console.error('获取资产选择列表时发生错误：', error);
    return error;
  }
}

/* 创建合规登记 */
export async function assetRegister(params: any) {
  try {
    return await request.post(API.ASSET_REGISTER, params);
  } catch (error) {
    console.error('创建合规登记时发生错误：', error);
    return error;
  }
}